package ro.gillardon.persistence;

import ro.gillardon.commons.config.ConfigParam;
import ro.gillardon.commons.config.ConfigProvider;
import ro.gillardon.persistence.document.DocumentDAOFactory;

/**
 * Abstract class that can construct various types of concrete DAO factories, each factory supporting a different type
 * of persistent storage implementation.
 *
 * @author haiurar
 */
public abstract class DAOFactory {

  public abstract HotelDetailsDAO getHotelDetailsDAO();

  public abstract ReservationDAO getReservationDAO();

  /**
   * Returns a concrete DAOFactory.
   *
   * @return a concrete DAOFactory
   */
  public static DAOFactory getDAOFactory() {
    final String daoType = ConfigProvider.getProperty(ConfigParam.DAO_TYPE);
    switch (daoType) {
      case "DOCUMENT" :
        return new DocumentDAOFactory();
      default :
        return null;
    }
  }
}
